package club.janna.jrpc.cluster.loadbalance.selector;

import java.util.Random;

/**
 * 随机选择器
 * @author Panbo.Guo
 */
public class RandomSelector implements Selector {

    /**
     * 上限
     */
    private final int limit;
    private final Random random = new Random();

    public RandomSelector(int limit) {
        this.limit = limit;
    }

    @Override
    public int next() {
        return random.nextInt(limit);
    }
}
